#include <windows.h>
#include <vector>
#include <string>
#include <xstring>
#include "structs.h"
#include "constants.h"
#include "types.h"

//GString xml_name;
unsigned char cBitValue;
char TypeOfCurrent;
char asstyp;
bool bReplaceFileChange = false;
bool bStatusByte = false;
bool bContextMenu = false;
bool bTableActive = false;
bool bTableLoaded = false;
bool bDumpToFile = true;
bool bOptimizeBytes = false;
bool bTermNewLine = false;
bool bPadBytes = false;
bool bReplaceToOffset = false;
bool bByteMark = true;
bool bDefByteMark = true;
bool bLastSearchType = 0;
bool bFirstSearch = true;
bool bThingyView = false;
bool bCleanScript = false;
bool bReadingTable = false;
bool bDumpClean = false;
bool bJPuncSwitch = true;
bool bJapanese = false;
bool bJPShift = false;
bool bJPEUC = false;
bool bHideHex = false;
bool bInsertMode = false;
bool bSeemsJ = false;
bool bDoingIME = false;
bool bIMEDone = false;
bool bFileRelativeResults = false;
bool bRelativeSearchDone = false;
bool bSplitMultiByte = true;
bool bIsEuc = false;
bool bIsShift = true;
bool bDiscardChangesSave = true;
bool bHighlight = false;
bool bSearchHex = false;
bool bAutomaticXAdjust = BST_CHECKED;
bool bAutomaticBPL;
bool bOldAutomaticBPL = false;
int iGotoDialogBufLength;
int iOpenReadOnlySetting;
int iStartPL;
int iNumBytesPl;
int iPLFileLength;
int iRemBookmark;
int iBookmarkOffset;
int iFindDialogBufLength;
int iFindDialogMatchCase;
int iFindDialogBytecode;
int iFindDialogDirection;
int iFindDialogLastLength;
int iCopyHexdumpDialogStart;
int iCopyHexdumpDialogEnd;
int iCopyHexdumpMode = BST_CHECKED;
int iDecValDialogOffset;
int iDecValDialogValue;
int iDecValDialogSize;
int iDecValDialogTimes;
int iPasteMode;
int iPasteMaxTxtLength;
int iPasteTimes = 1;
int iPasteSkip;
int iCutMode = BST_CHECKED;
int iOldBPL = 0;
int iBPLSetting;
int iOffsetLengthSetting;
int iAppendbytes;
int iManipPos;
int iCharacterSetting;
int iCharacterSettingSearch=ENCODING_BYTE;
int iFontSizeSetting;
int bUnsignedViewSetting;
int iDiffNum;
int iBinaryModeSetting;
int iStartOfSelSetting;
int iEndOfSelSetting;
int iPasteAsText;
int iDestFileLength;
int iSrcFileLength;
int buflen;
int FWFile;
int FWFilelen;
int tmpstart;
int tmpend;
int dumps = 0;
int inserts = 0;
int optimized = 0;
int iMaxCharLine = 0;
int iLastMaxCharLine = 0;
int iLastDumpTarget = 0; 
int iBytesPerLine;
int iOffsetMode = STANDARDHEX;
int SNESHEADER = 512;
//int iOldAutosize = 0;
//int iOldBytesPerLine = 0;
int iLastRelativeValue = -1;
int iRealTable = 0;
long iCutOffset;
long iCutNumberOfBytes;
long iCopyStartOffset;
long iCopyEndOffset;
long iIncrementStep = 0;
long iProgressPos = 0;
long iFileSize = 0;
long iDumpStart = 0;
long iDumpEnd = 0;
bookmark *pbmkRemove;
intpair* pdiffChoice;
tablevalue tvDakuten;
tablevalue tvHandakuten;
longpair ppair;
//TCHAR cFileName[_MAX_PATH];
TCHAR pcBookmarkTxt[iBookmarkMaxChars];
TCHAR pcFWText[FILL_WITH_MAX];
TCHAR cBuf[FILL_WITH_MAX];
TCHAR szFWFileName[_MAX_PATH];
TCHAR *pcGotoDialogBuffer;
//TCHAR *pcFindDialogBuffer;
TCHAR *pcTmplText;
TCHAR *pcPasteText;
LONG oldproc;
LONG cmdoldproc;
COLORREF cTextColor = RGB (0,0,0);
COLORREF cBkColor = RGB (255,255,255);
COLORREF cTextColorE = RGB(0,0,255);
COLORREF cTextColorO = RGB(255,0,0);
COLORREF cSepColor = RGB (192,192,192);
COLORREF cSelBkColor = RGB( 255, 255, 0 );
COLORREF cSelTextColor = RGB( 0, 0, 0 );
COLORREF cBookmarkColor = RGB( 255, 0, 0 );
COLORREF cHighlightColor = RGB(180,0,150);
COLORREF cChangesColor = RGB(255,150,0);
COLORREF cDTEColor = RGB(120,0,215);
HFONT hfon;
HFONT hfdef;
HFONT hfJap;
RECT IMEPos;
_tstring sLastTableSearch;
_tstring sLastTableReplace;
_tstring sFileName;
_tstring sNull;
_tstring sNewLine;
_tstring sScriptDump;
_tstring sByteOpen = _T("<");
_tstring sByteClose = _T(">");
_tstring sRelSearchString;
_tstring sLoadedTable;
_tstring sWindowsPath;
_tstring sAppPath;
_tstring sHexSearchString;
_tstring strToReplaceData;
_tstring strReplaceWithData;
_tstring TxtEditName;
//_tstring sBrowserName;
std::vector<_tstring> vEmpty;
std::vector<_tstring> vHexdoc;
std::vector<tablevalue> vEmptyTable;
std::vector<scriptdump> vScriptDumps;
std::vector<_tstring> vPLineBuf;
std::vector<_tstring> vEmptyOB(256);
std::vector<_tstring> vEmptyTB(65536);
std::vector<_tstring> vTableOut(256);
std::vector<_tstring> vDualTileTableIn(65536);
std::vector<_tstring> vDualByteTableOut(65536);
std::vector<_tstring> vTwoByteHighlightTable(65536);
//std::vector<tablevalue> vMultiByteTableIn;
std::vector<_tstring> vTableIn(256);
std::vector<int> viEmpty;
//std::vector<relativescandata> vScanData;
//std::vector<relation> vRelativeOffsets;
//std::vector<int> vValueList;
//std::vector<std::string> vHighlights;
std::vector<linkedvalue> vLinked;
std::vector<_tstring> vIMEBytes;
//std::vector<_tstring> vTableFileLeft;
//std::vector<_tstring> vTableFileRight;
// holds colors for the changed values
std::vector<_tstring> vChanges;
std::vector<_tstring> vHighlights;
std::vector<_tstring> vDTEs;
std::vector<bool> vbEmpty;
std::vector<tablevalue> vMultiByteTableOut;
HWND hMainWnd;
HWND progress1 = NULL;
HWND progress2 = NULL;
